<?php
$servername = "localhost";
$username = "root";
$password = "123456";
$dbname = "zb";

// 创建连接
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("连接失败: " . mysqli_connect_error());
}

$sql = "SELECT * FROM date";

$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
    // 输出数据
    $arr = array();
    while($row = mysqli_fetch_assoc($result)) {
        array_push($arr,array($row["user"],$row["source"],$row["money"]));
        //echo $row["user"]."*".$row["source"]."*".$row["money"]."$";
    }
    echo json_encode($arr);
} else {
    echo "暂无记录";
}

mysqli_close($conn);
?>